<%@ page import="cn.edu.lingnan.pojo.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Objects" %>
<%@ page import="cn.edu.lingnan.pojo.Participation" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="../css/updateAll.css">
</head>

<body>
<h1 align="center">岭南师范学院学生竞赛系统管理页面----更新页面</h1>
<hr><br><a href="/loginOut" class="link-style">注销</a>
<a href="#" onclick="window.history.back()" class="link-style">返回</a>
<div class="container">
    <form action="updatePart">
        <table>
            <tr>
                <th>记录编号</th>
                <th>学生编号</th>
                <th>比赛编号</th>
                <th>比赛名称</th>
                <th>分数</th>
                <th>排名</th>
                <th>选择操作</th>
            </tr>
            <%
                List<Participation> allPart =(List<Participation>)session.getAttribute("allPart");
                String pid = request.getParameter("pid");
                String rank = request.getParameter("rank");
                for(Participation participation:allPart){
                    if((participation.getId()+"").equals(pid)){//id是整数型的，要转换为字符型才能比较
            %>
            <tr><!--pid不能修改，给它隐藏域，因要传递数据 -->
                <td class="narrow-column"><input type="hidden" name="pid" value="<%=participation.getId()%>"><%=participation.getId()%></td>
                <td class="narrow-column"><input type="hidden" name="studentId" value="<%=participation.getStudent_id()%>"><%=participation.getStudent_id()%></td>
                <td class="narrow-column"><input type="hidden" name="competitionId" value="<%=participation.getCompetition_id()%>"><%=participation.getCompetition_id()%></td>
                <td class="narrow-column"><input type="hidden" name="competitionName" value="<%=participation.getCompetition_name()%>"><%=participation.getCompetition_name()%></td>
                <td><input type="text" name="score" value="<%=participation.getScore()%>"></td>
                <td class="narrow-column"><input type="hidden" name="rank" value="<%=rank%>"><%=rank%></td>
                <input type="hidden" name="status" value="<%=participation.getStatus()%>">

                <td>
                    <input type="submit" value="确认修改"/>
                </td>
            </tr>
            <%
                    }
                }
            %>
        </table>
    </form>
</div>

</body>
</html>
